#ifndef __PROCESS_H__
#define __PROCESS_H__

typedef enum {
    CONTROL_WINDOW = 0,
    CONTROL_DOOR,
    CONTROL_LIGHT,
    CONTROL_SUNROOF,
    CONTROL_TRUNK,
    CONTROL_FINDCAR,
    CONTROL_IMMOLOCK,
    CONTROL_END,
} EnumControlType;

typedef enum {
    ENG_DATA_RPM = 0,
    ENG_DATA_VS,
    ENG_DATA_ECT,
    ENG_DATA_IAT,
    ENG_DATA_APP,
    ENG_DATA_TP,
    ENG_DATA_ERT,
    ENG_DATA_LOAD,
    ENG_DATA_BATTVOLT,
    ENG_DATA_REALFUELCO,
    ENG_DATA_FUELLEVEL,
    ENG_DATA_ODO,
    ENG_DATA_LTFT,
    ENG_DATA_STFT,
    ENG_DATA_MISFIRE1,
    ENG_DATA_MISFIRE2,
    ENG_DATA_MISFIRE3,
    ENG_DATA_MISFIRE4,
    ENG_DATA_MISFIRE5,
    ENG_DATA_MISFIRE6,
    ENG_DATA_FCLS,
    ENG_DATA_KEYSTATUS,
    ENG_DATA_HO2S1,
    ENG_DATA_HO2S2,
    ENG_DATA_MAP,
    ENG_DATA_INJECTPULSE,
    ENG_DATA_OILPRESSURE,
    ENG_DATA_OILLEVELSTATUS,
    PID_SIZE,
} EnumPidType;

typedef enum {
    BCM_DATA_LFWIN,
    BCM_DATA_RFWIN,
    BCM_DATA_LRWIN,
    BCM_DATA_RRWIN,
    BCM_DATA_DDA,
    BCM_DATA_PDA,
    BCM_DATA_RRDA,
    BCM_DATA_LRDA,
    BCM_DATA_SUNROOF,
    BCM_DATA_PARKLAMP,
    BCM_DATA_HEADLAMP,
    BCM_DATA_CHARGESTATUS,
    BCM_DATA_BATTCURRENT,
    BCM_DATA_BATTSTATUS,
    BCM_DATA_BATTVOLT,
    BCM_DATA_ODO,
    BCM_DATA_SIZE,
} EnumBcmType;

typedef enum {
    IPC_DATA_REALFUELCO,
    IPC_DATA_ODO,
    IPC_DATA_FUELLEVEL,
    IPC_DATA_SIZE
} EnumIpcType;

typedef struct __FixTime {
    uint16_t year;
    uint8_t mon;
    uint8_t day;
    uint8_t hour;
    uint8_t min;
    uint8_t sec;
} FixTime;

#define ENG_DATA_SIZE               (PID_SIZE - ENG_DATA_RPM)
#define BCM_DATA_SIZE               (BCM_DATA_SIZE - BCM_DATA_LFWIN)
#define IPC_DATA_SIZE               (IPC_DATA_SIZE - IPC_DATA_REALFUELCO)

#define BCM_MAX_SIZE                32
#define BCM_DOOR_SIZE               4
#define BCM_WINDOW_SIZE             4

void set_lock(void);
void set_unlock(void);
uint8_t process_check_engine(void);
void process_init(void);
void process_task(void *unused);
void process_rpm_task(void *unused);
void process_1s_hook(void);
void process_500ms_hook(void);
void process_10s_hook(void);

uint8_t gsensor_init(void);
uint8_t detect_motion(void);

#endif
